<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="s" uri="/struts-tags" %>

<div id="filter">
    <s:form action="list" cssClass="tableFilter">
        <tr>
            <th colspan="4" class="tableTitle">
                <h5>Search</h5>
            </th>
        </tr>

        <s:textfield label="Email" name="mail.email"  />
        <s:select label="Country" name="mail.pais.id"
                  headerKey="" headerValue="Choose Country"
                  list="paisList"
                  listKey="id"
                  listValue="country"
                >
        </s:select>

        <tr>
            <td colspan="2" class="centeredButtons"><s:submit value="Search" name="filter" theme="simple"/>
                <s:submit action="create" value="New" theme="simple" onclick="resetForms();"/></td>
        </tr>
    </s:form>
</div>

<s:if test="!list.isEmpty()">
    <div id="table_content">
        <table>
            <thead>
            <tr>
                <th>Email</th>
                <th>Country</th>
                <th></th>
            </tr>
            </thead>
            <tbody>
            <s:iterator value="list" var="d">
            <tr>
                <th><s:property value="email"/></th>
                <th><s:property value="pais.country"/></th>
                <th>
                    <s:form action="create" method="POST">
                    <s:hidden value="%{id}" name="mailId"/>
                    <a onclick="$(this).closest('form').submit()"><img src="<s:url value="/images/edit.png"/>" title="Edit" alt="Edit"></a></TH>
                </s:form>
                </th>
            </tr>
            </s:iterator>

            <tbody>
        </table>
    </div>
</s:if>

<script type="text/javascript">
    var list = true;
    $('#mails').css({"color":"#EE5102","fontWeight":"bold"});
</script>